package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.OmsOrderItem;
import com.itheima.mapper.OmsOrderItemMapper;
import com.itheima.service.OmsOrderItemService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单中所包含的商品 服务实现类
 * </p>
 *
 * @author zhuguo
 * @since 2022-11-10
 */
@DubboService
public class OmsOrderItemServiceImpl extends ServiceImpl<OmsOrderItemMapper, OmsOrderItem> implements OmsOrderItemService {

    @Autowired
    OmsOrderItemMapper omsOrderItemMapper;

    //根据订单id查询订单所包含的商品
    @Override
    public List<OmsOrderItem> findOrderItem(Long orderId) {
        LambdaQueryWrapper<OmsOrderItem> qw = new LambdaQueryWrapper<>();
        qw.eq(orderId != null, OmsOrderItem::getOrderId, orderId);
        return omsOrderItemMapper.selectList(qw);
    }
}
